$(function(){
	
	//menu
    $(".navico").click(function(){
    	$(".header").toggleClass("on");
    	$(".nav").slideToggle();
    	$(".mmask").slideToggle(0);
    })
    
    $(".mmask").click(function(){
    	$(".nav").hide();
    	$(".mmask").hide();
    	$(".header").removeClass("on");
    })
	
	//banner
	var mySwiper = new Swiper('.indexbanner',{
	    pagination: '.indexbanner .swiper-pagination',
	    autoplay:5000, 
	    paginationClickable: true,
	  })
	  
	
	
	
    //tab
	function tabs(tabTit, on, tabCon) {
        $(tabTit).children().hover(function () {
            $(this).addClass(on).siblings().removeClass(on);
            var index = $(tabTit).children().index(this);
            $(tabCon).children().eq(index).show().siblings().hide();
        });
    };
    tabs(".tab-hd", "on", ".tab-bd");
    
    //tab
	function subtabs(tabTit, on, tabCon) {
        $(tabTit).children().click(function () {
            $(this).addClass(on).siblings().removeClass(on);
            var index = $(tabTit).children().index(this);
            $(tabCon).children().eq(index).show().siblings().hide();
        });
    };
    subtabs(".stab-hd", "on", ".stab-bd");
	
	//首页动态
	if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion.split(";")[1].replace(/[ ]/g, "").replace("MSIE", "")) < 9) {

    } else {
        window.sr = ScrollReveal();
        sr.reveal('.rev', {duration: 1500, distance: '50px' }, 50);
        sr.reveal('.rev-r', {duration: 1500, distance: '100px', origin: 'right' }, 300);
        sr.reveal('.rev-l', {duration: 1500, distance: '100px', origin: 'left' }, 300);
        sr.reveal('.rev-t', {duration: 1500, distance: '100px', origin: 'top' }, 300);
        sr.reveal('.rev-b', {duration: 1500, distance: '100px', origin: 'bottom' }, 300);
    }
    
    $(".ixc-left").click(function(){
    	$(".ixcontact-top .stab-hd").scrollLeft(0);
    })
    $(".ixc-right").click(function(){
    	$(".ixcontact-top .stab-hd").scrollLeft(600);
    })
    
    if($(window).width() > 1000){
    	$(".stab-hd li").click(function(){
	    	var x = $(".stab-hd li.on").offset().left;
			var ww = $(window).width();
			if(x > ww/2){
				$(".stab-hd").scrollLeft(x);
			}else {
				$(".stab-hd").scrollLeft(0);
			}
	    });
	    
	    //专业领域内页
		var mySwiper1 = new Swiper('.nyarea-artsw',{
	        nextButton: '.nyarea-artsw .swiper-button-next',
	        prevButton: '.nyarea-artsw .swiper-button-prev',
		    slidesPerView: 5,
		    centeredSlides: true,
		    paginationClickable: true,
		  }) 
		$(".nyarea-artsw .swiper-slide").click(function(){
			var index = $(".nyarea-artsw .swiper-slide").index(this);
	    	mySwiper1.slideTo(index, 1000)
		})
    };
    
     if($(window).width() < 1000){
    	
	    //专业领域内页
		var mySwiper1 = new Swiper('.nyarea-artsw',{
	        nextButton: '.nyarea-artsw .swiper-button-next',
	        prevButton: '.nyarea-artsw .swiper-button-prev',
		    slidesPerView: 3,
		    centeredSlides: true,
		    paginationClickable: true,
		  }) 
		$(".nyarea-artsw .swiper-slide").click(function(){
			var index = $(".nyarea-artsw .swiper-slide").index(this);
	    	mySwiper1.slideTo(index, 1000)
		})
    };


    //右边fixed层
    var $fixedLayer = $(".fixed-layer");
    var $toTop = $(".to-top");
    var $fixedLayerPopItem = $(".fixed-layer li:has(.fixed-layer-pop)");
    $(window).scroll(function(){
        if($(this).scrollTop() < 360){
            $fixedLayer.stop().fadeOut(400);
        }else{
            $fixedLayer.stop().fadeTo(400,1);
        }
    });
    $toTop.click(function(){
        $("html,body").animate({"scrollTop":0},400);
    });
    $fixedLayerPopItem.hover(function(){
        $(this).find(".fixed-layer-pop").stop().fadeTo(400,1);
    },function(){
        $(this).find(".fixed-layer-pop").stop().fadeOut(400);
    });
    
    //加入我们
    $(".nyls-join .nyls-zw li .tit").click(function(){
    	$(this).parents("li").toggleClass("on");
    	$(this).next().slideToggle();
    });
    
    
    
    
    
})
